package cn.ben3.addondsl.model;

import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType;
import org.springframework.roo.classpath.details.annotations.AnnotationMetadata;
import org.springframework.roo.model.JavaType;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: c
 * Date: 13-7-7
 * Time: 下午3:22
 * To change this template use File | Settings | File Templates.
 */
public class AnnotatedJavaTypeBuilder {
    private AnnotatedJavaType ajt;
    private JavaType javaType;
    private List<AnnotationMetadata> anos=new ArrayList<AnnotationMetadata>();

    public AnnotatedJavaTypeBuilder(JavaType javaType) {
        this.javaType=javaType;
    }
    public AnnotatedJavaTypeBuilder ada(AnnotationBuilder ab){
        this.anos.add(ab.build()) ;
        return this;
    }
    public AnnotatedJavaType build(){
        if(ajt==null) {
            ajt = new AnnotatedJavaType(javaType, anos);
        }
        return ajt;
    }
}
